package com.six.core.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.six.core.entity.RolePermission;
import com.six.core.mapper.RolePermissionMapper;
import com.six.core.service.RolePermissionService;
import com.six.core.vo.PermissionVo;
import com.six.core.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @Description:
 * @author:LiWei
 * @date:2023年02月27日18:53
 */
@Service
public class RolePermissionServiceImpl extends ServiceImpl<RolePermissionMapper,RolePermission> implements RolePermissionService {


    @Autowired
    private RolePermissionMapper rolePermissionMapper;
    @Override
    public Result confirmPermission(Integer roleId, Integer[] pIds) {

        //先删除
        rolePermissionMapper.deleteByUserId(roleId);
        //添加权限
        rolePermissionMapper.insertRoleId(roleId,pIds);

        return new Result(200,"分配成功",null);
    }
}
